package com.example.mvvmapplication.adapter

import android.util.Log
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.mvvmapplication.R
import com.example.mvvmapplication.domain.MapData
import kotlinx.android.synthetic.main.item_sell_rv.view.*

/**
 *
 * @ClassName:      SellAdapter$
 * @Description:    sell的adapter实现
 * @Author:         xinya
 * @CreateDate:     2020/11/3$ 18:52$
 * @UpdateRemark:   更新内容
 * @Version:        1.0
 */
class SellAdapter(layoutResId: Int, data: MutableList<MapData>? = null) :
    BaseQuickAdapter<MapData, BaseViewHolder>(layoutResId, data) {

    override fun convert(holder: BaseViewHolder, item: MapData) {
        holder.setText(R.id.itemTvTitle, item.title)
        holder.setText(R.id.itemTvPrice, String.format("%.2f",
            (item.zk_final_price.toFloat() - item.coupon_amount)))
        Glide.with(context).load("https:${item.pict_url}").into(holder.getView(R.id.itemIvIcon))
    }

}